package com.hyy.common.config;

import com.hyy.common.utils.Redis;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;

@Configuration
public class RedisConfig {


    @Bean
    @ConditionalOnProperty(prefix="spring.data.redis",name="host")//存在reids中的host的值才会注册bean
    public Redis redis(StringRedisTemplate redisTemplate) {
        return new Redis(redisTemplate);
    }
}
